import { IThemeColor } from '../../../../type/index';

export const initPerStageWorked = (echarts: any, dom: HTMLElement, vlaueData: number[], labelData: string[], themeColor: IThemeColor) => {
  const charts = echarts.init(dom);
  charts.setOption({
    title: {
      text: '每期就业人数与趋势',
      textStyle: {
        color: themeColor.font,
        fontSize: 16,
        fontWeight: 'normal',
      },
      padding: [16, 0, 0, 16],
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        crossStyle: {
          width: 1.4,
        },
        lineStyle: {
          width: 1.4,
        },
        textStyle: {
          color: themeColor.font,
        },
      },
    },
    grid: {
      top: '15%',
      bottom: '20%',
      left: '5%',
      right: '5%',
    },
    legend: {
      top: '5%',
      right: '5%',
      textStyle: {
        color: themeColor.font,
      },
      data: ['发展趋势', '数量统计'],
    },
    xAxis: [
      {
        type: 'category',
        axisLine: {
          lineStyle: {
            color: themeColor.border,
          },
        },
        splitLine: {
          show: false,
        },
        axisTick: {
          show: false,
        },
        data: labelData,
      },
    ],

    yAxis: [
      {
        type: 'value',
        splitLine: {
          show: true,
          lineStyle: {
            color: themeColor.border,
          },
        },
        axisLine: {
          lineStyle: {
            color: themeColor.border,
          },
        },
        axisLabel: {
          fontSize: 16,
        },
      },
    ],
    dataZoom: [
      {
        show: true,
        height: 30,
        bottom: '5%',
        xAxisIndex: [0],

        start: 30,
        end: 100,
        handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
        handleSize: '110%',
        handleStyle: {
          // color: '#5B3AAE',
          color: '#6f7de3',
        },
        textStyle: {
          color: themeColor.font,
        },
        fillerColor: 'rgba(67,55,160,0.4)',
        borderColor: themeColor.border,
      },
      // {
      //   type: 'inside',
      //   show: true,
      //   height: 45,
      //   // start: 1,
      //   // end: 35,
      // },
    ],
    series: [
      {
        name: '发展趋势',
        type: 'line',
        symbolSize: 10,
        symbol: 'circle',
        itemStyle: {
          color: '#c257F6',
          // color: '#6f7de3',
        },
        data: vlaueData,
      },
      {
        name: '数量统计',
        type: 'bar',
        barWidth: 14, // 柱子宽度
        label: {
          show: true,
          color: themeColor.font,
          fontSize: 14,
          distance: 14, // 距离
          position: 'top',
        },
        itemStyle: {
          borderRadius: [2, 2, 2, 2], // 圆角（左上、右上、右下、左下）
          color: '#6f7de3',
          // color: '#c257F6',
        },
        data: vlaueData,
      },
    ],
  });
};
